// packageMy/pages/myConsultationEvaluate/myConsultationEvaluate.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0,
    textare:'',
    currentTime:''
  },
  onTapGoBack(){
    wx.navigateBack({
      delta: 1 // 返回上一页
    });
  },
  onText(e){
    this.setData({
      textare: e.detail.value
    })
  },
  filterIstrue(){
    this.onTime() 
    wx.request({
      url: 'http://localhost:8081/sfzy/comment',
      method:'POST',
      data:{
        consultationAppointmentId:this.data.id,
        context:this.data.textare,
        createTime:this.data.currentTime,
        del:0
      },
      success:(res)=>{
        console.log(this.data.id);
        console.log(this.data.textare);
        console.log(this.data.currentTime);
          wx.navigateTo({
            url: '/packageMy/pages/myConsultation/myConsultation?complete=1',
          })
      }
    })
  },
  onTime() {
    let currentDate = new Date();
    let year = currentDate.getFullYear();
    let month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
    let day = currentDate.getDate().toString().padStart(2, '0');
    let hours = currentDate.getHours().toString().padStart(2, '0');
    let minutes = currentDate.getMinutes().toString().padStart(2, '0');
    let seconds = currentDate.getSeconds().toString().padStart(2, '0');
    let currentTimeStr = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
    this.setData({
        currentTime: currentTimeStr
    });
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      id:options.id
    })
    console.log();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})